


//数组求和迭代版
int sum1(int a[],int n)
{
    int sum = 0;//初始化累计器，O(1)
    for (int i = 0; i < n; ++i)
    {
        sum += a[i];
    }
    return sum;
}